package db

import (
	"github.com/itstonight/ziyue/models"
	"gorm.io/driver/postgres"
	"gorm.io/gorm"
)

var Client *gorm.DB

func Boot(source string) (err error) {
	Client, err = gorm.Open(postgres.Open(source), &gorm.Config{})
	if err != nil {
		return err
	}

	return Client.AutoMigrate(models.Tables...)
}
